/**
 * Created by xiangyufang on 2016/9/23.
 */
;(function($,window,document,undefined){
    /***运行记录二级页面
     * 后台传递一个ID和TYPE值
     * 以此来判定是那个设备类型下的那一条数据
     * ***/
    //从后台传过来的全局数据ID和Type
    var comId = $('#JQ_common_id').val();
    var type = $('#JQ_common_type').val();


    //各模块显示部分变量初始化
    var $power_div = $('#JQ_power');
    var $long_div = $('#JQ_long');
    var $bed_div = $('#JQ_bed');
    var $insu_div = $('#JQ_insu');
    var $avoid_div = $('#JQ_avoid');
    var $line_div = $('#JQ_line');
    var $pile_div = $('#JQ_pile');
    var $sacri_div = $('#JQ_sacri');
    var $elec_div = $('#JQ_elec');


    /*** SELECT选框初始化start ***/
    //阴保电源运行状态
    var $power_state = $('#JQ_power_state').select3({
        search: false,
        data: [
            {id: 'RUNNING', text: '运行中'},
            {id: 'WRITTEN_OFF', text: '已报废'},
            {id: 'MAINTENANCE', text: '维修中'},
            {id: 'LEAVE_UNUSED', text: '闲置中'}
        ]
    });
    //阴保电源停机原因
    var $power_reason = $('#JQ_power_reason').select3();
    DyyBase.ajax(corrctrlApi.url_run_power_reason(), {}, function(dataset){
        var json = DyyBase.getSelect(dataset);
        $power_reason.add(json);
    });

    //长效参比是否异常
    var $long_whether = $('#JQ_long_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });

    //绝缘装置是否异常
    var $insu_whether = $('#JQ_insu_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });

    //防浪涌保护器是否异常
    var $avoid_whether = $('#JQ_avoid_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });

    //阴保测试桩是否异常
    var $pile_whether = $('#JQ_pile_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });

    //牺牲阳极是否异常
    var $sacri_whether = $('#JQ_sacri_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });

    //排流装置是否异常
    var $elec_whether = $('#JQ_elec_whether').select3({
        search:false,
        data:[
            {id:'true',text:'是'},
            {id:'false',text:'否'}
        ]
    });
    /*** SELECT选框初始化end ***/

    /*** 数据筛选start ***/
    var filter = {
        //阴保电源查询参数
        getPowerFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //运行状态
            filter.operationStatus = function(){
                var v  = $power_state.val();
                if(v){
                    return v;
                }
                return '';
            }();
            //停机原因
            filter.downReason = function(){
                var v  = $power_reason.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_power_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_power_startDate').val();
                var v2  = $('#JQ_power_endDate').val();
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_power_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //阴保电源导出参数
        getPowerExportFilter: function(){
            return filter.getPowerFilter();
        },
        //长效参比查询参数
        getLongFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $long_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_long_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_long_startDate').val();
                var v2  = $('#JQ_long_endDate').val();
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_long_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //长效参比导出参数
        getLongExportFilter: function(){
            return filter.getLongFilter();
        },
        //阳极地床查询参数
        getBedFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_bed_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_bed_startDate').val();
                var v2  = $('#JQ_bed_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_bed_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //阳极地床查询参数
        getBedExportFilter: function(){
            return filter.getBedFilter();
        },
        //绝缘装置查询参数
        getInsuFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $insu_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_insu_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_insu_startDate').val();
                var v2  = $('#JQ_insu_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_insu_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //绝缘装置导出参数
        getInsuExportFilter: function(){
            return filter.getInsuFilter();
        },
        //防浪涌保护器查询参数
        getAvoidFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $avoid_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_avoid_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_avoid_startDate').val();
                var v2  = $('#JQ_avoid_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_avoid_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //防浪涌保护器导出参数
        getAvoidExportFilter: function(){
            return filter.getAvoidFilter();
        },
        //跨接线数据查询参数
        getLineFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_line_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_line_startDate').val();
                var v2  = $('#JQ_line_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_line_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //跨接线导出参数
        getLineExportFilter: function(){
            return filter.getLineFilter();
        },
        //阴保测试桩查询参数
        getPileFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $pile_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            return filter;
        },
        //阴保测试桩导出参数
        getPileExportFilter: function(){
            return filter.getPileFilter();
        },
        //牺牲阳极查询参数
        getSacriFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $sacri_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_sacri_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_sacri_startDate').val();
                var v2  = $('#JQ_sacri_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_sacri_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //牺牲阳极导出参数
        getSacriExportFilter: function(){
            return filter.getSacriFilter();
        },
        //排流装置查询参数
        getElecFilter: function(data){
            var filter = {};
            filter.mode = true;
            filter.deviceId = comId;
            // 分页参数
            if(data){
                if (data.start == 0) {
                    filter['jsonBean.pageNum'] = 1;
                } else {
                    filter['jsonBean.pageNum'] = data.start / 10 + 1;
                }
                filter['jsonBean.pageCount'] = data.length;
            }
            //是否异常
            filter.hasException = function(){
                var v  = $elec_whether.val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间1
            filter.recordBeginDate = function(){
                var v  = $('#JQ_elec_startDate').val();
                if(v){
                    return v;
                }
                return '';
            }();
            // 购买时间2
            filter.recordEndDate = function(){
                var v1  = $('#JQ_elec_startDate').val();
                var v2  = $('#JQ_elec_endDate').val();;
                if(v2){
                    if(v1){
                        if(!(Dyy.checkDateLate(v1,v2))){
                            $('#JQ_elec_endDate').TIP({content:'结束日期应晚于开始日期!'});
                            filter.mode = false;
                        }
                    }
                    return v2;
                }
                return '';
            }();
            return filter;
        },
        //排流导出参数
        getElecExportFilter: function(){
            return filter.getElecFilter();
        }
    };
    /*** 数据筛选end ***/

    /*** 表格数据渲染start ***/
    //定义变量
    var DTPOWER,DTLONG,DTBED,DTINSU,DTAVOID,DTLINE,DTPILE,DTSACRI,DTELEC;
    var $power_table = $('#JQ_power_table');
    var $long_table = $('#JQ_long_table');
    var $bed_table = $('#JQ_bed_table');
    var $insu_table = $('#JQ_insu_table');
    var $avoid_table = $('#JQ_avoid_table');
    var $line_table = $('#JQ_line_table');
    var $pile_table = $('#JQ_pile_table');
    var $sacri_table = $('#JQ_sacri_table');
    var $elec_table = $('#JQ_elec_table');


    //判断type值拉取相应模块填充数据
    if(type == 'CPPOWER'){
        DyyBase.ajax(corrctrlApi.url_device_power(),{eqptId:comId},function(dataSet){
            $('#JQ_power_room').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_power_number').text(dataSet.result.list[0].customNumber);
            $('#JQ_power_type').text(dataSet.result.list[0].cppowerType);
        });
        $power_div.show();
        //阴保电源表格数据
        DTPOWER = $power_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getPowerFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_power(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                    var lengthData = dataset.result.list;
                    if(lengthData.length === 0){
                        $('#JQ_power_count').attr('data-empty', 'true');
                    }else{
                        $('#JQ_power_count').attr('data-empty', 'false');
                    }
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'outputVoltage',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'outputCurrent',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'settingPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'metricalPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'downBeginDate',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'REFERENCE'){
        DyyBase.ajax(corrctrlApi.url_device_long(),{eqptId:comId},function(dataSet){
            $('#JQ_long_name').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_long_valve').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_long_type').text(dataSet.result.list[0].referenceTypes);
            $('#JQ_long_number').text(dataSet.result.list[0].customNumber);
        });
        $long_div.show();
        //长效参比表格数据
        DTLONG = $long_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getLongFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_long(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'measuredReferencePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'standardReferencePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'measuredOpenPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'standardOpenPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'ANODESBED'){
        DyyBase.ajax(corrctrlApi.url_device_bed(),{eqptId:comId},function(dataSet){
            $('#JQ_bed_valve').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_bed_type').text(dataSet.result.list[0].materialType);
            $('#JQ_bed_object').text(dataSet.result.list[0].protectionObject);
            $('#JQ_bed_number').text(dataSet.result.list[0].customNumber);
        });
        $bed_div.show();
        //阳极地床表格数据
        DTBED = $bed_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getBedFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_bed(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'groundingResistance',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'maintenanceRecord',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if(exState === '未处理'){
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if(exState == '已处理'){
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else{
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'INSULATEDJOINT'){
        DyyBase.ajax(corrctrlApi.url_device_insu(),{eqptId:comId},function(dataSet){
            $('#JQ_insu_pile').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_insu_valve').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_insu_type').text(dataSet.result.list[0].insulatedJointType);
            $('#JQ_insu_object').text(dataSet.result.list[0].protectionFacilities);
            $('#JQ_insu_number').text(dataSet.result.list[0].customNumber);
        });
        $insu_div.show();
        //绝缘装置表格数据
        DTINSU = $insu_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getInsuFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_insu(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'nonProtectivePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'protectivePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'innerCurrent',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'externalCurrent',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'ANTISURGE'){
        DyyBase.ajax(corrctrlApi.url_device_avoid(),{eqptId:comId},function(dataSet){
            $('#JQ_avoid_pile').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_avoid_valve').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_avoid_test').text(dataSet.result.list[0].teststationnumber);
            $('#JQ_avoid_object').text(dataSet.result.list[0].potectorType);
            $('#JQ_avoid_number').text(dataSet.result.list[0].customNumber);
        });
        $avoid_div.show();
        //放浪涌保护器表格数据
        DTAVOID = $avoid_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getAvoidFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_avoid(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'nonProtectivePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'protectivePotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'appearanceCheck',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'CPJUMPER'){
        DyyBase.ajax(corrctrlApi.url_device_line(),{eqptId:comId},function(dataSet){
            $('#JQ_line_pile').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_line_valve').text(dataSet.result.list[0].pipeValveroomName);
            $('#JQ_line_test').text(dataSet.result.list[0].teststationnumber);
            $('#JQ_line_type').text(dataSet.result.list[0].jumperType);
            $('#JQ_line_number').text(dataSet.result.list[0].customNumber);
        });
        $line_div.show();
        //跨接线表格数据
        DTLINE = $line_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getLineFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_line(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'crosswireConnecttion',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'crosswireDisConnection1',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'connectingPipeName1',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'crosswireDisConnection2',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'connectingPipeName2',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'solderJointInspection',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState === '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'CPTESTSTATION'){
        DyyBase.ajax(corrctrlApi.url_device_pile(),{eqptId:comId},function(dataSet){
            $('#JQ_pile_pileName').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_pile_testNum').text(dataSet.result.list[0].customNumber);
            $('#JQ_pile_hanType').text(dataSet.result.list[0].solderJointsCorrosion);
            $('#JQ_pile_function').text(dataSet.result.list[0].purpose);
        });
        $pile_div.show();
        //阴保测试桩表格数据
        DTPILE = $pile_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getPileFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_pile(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                    var lengthData = dataset.result.list;
                    if(lengthData.length === 0){
                        $('#JQ_pile_count').attr('data-empty', 'true');
                    }else{
                        $('#JQ_pile_count').attr('data-empty', 'false');
                    }
                });
            },
            'drawCallback': function (d) {
            },
            'columns': [
                {
                    data: 'freeCorrosionPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'onPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'offPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'acInterferenceVoltage',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'testStationFineStatus',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'SAALANODE'){
        DyyBase.ajax(corrctrlApi.url_device_sacri(),{eqptId:comId},function(dataSet){
            $('#JQ_sacri_pile').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_sacri_type').text(dataSet.result.list[0].sacrificialAnodeType);
            $('#JQ_sacri_object').text(dataSet.result.list[0].protectionObject);
            $('#JQ_sacri_typeH').text(dataSet.result.list[0].coatingMaterial);
            $('#JQ_sacri_testNum').text(dataSet.result.list[0].teststationnumber);
        });
        $sacri_div.show();
        //牺牲阳极表格数据
        DTSACRI = $sacri_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getSacriFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_sacri(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'onPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'sacalAnodeOpenPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'currentOut',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'groundingResistance',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'soilResistivity',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }else if(type == 'CURRENTDRAINAGE'){
        DyyBase.ajax(corrctrlApi.url_device_elec(),{eqptId:comId},function(dataSet){
            $('#JQ_elec_pile').text(dataSet.result.list[0].pipeLineName);
            $('#JQ_elec_type').text(dataSet.result.list[0].currentdrainage);
            $('#JQ_elec_typeG').text(dataSet.result.list[0].interferenceType);
            $('#JQ_elec_way').text(dataSet.result.list[0].drainageMethod);
            $('#JQ_elec_test').text(dataSet.result.list[0].teststationnumber);
            $('#JQ_elec_number').text(dataSet.result.list[0].customNumber);
        });
        $elec_div.show();
        //排流装置表格数据
        DTELEC = $elec_table.DataTable({
            'language': {
                'paginate': {
                    'next': '下一页',
                    'previous': '上一页'
                },
                'info': '本次检索共 _TOTAL_ 条，每页显示 10 条，共 _PAGES_ 页',
                'zeroRecords':DyyBase.table_empty(),
                'infoEmpty': ''
            },
            'autoWidth': false,
            'order': [],
            'serverSide': true,
            'pageLength': 10,
            'ordering': false,
            'processing': false,
            'searching': false,
            'lengthChange': false,
            'ajax': function (data, callback) {
                var param = filter.getElecFilter(data);
                DyyBase.ajax(corrctrlApi.url_run_detail_elec(), param, function (dataset) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = dataset.result.total;
                    returnData.recordsFiltered = dataset.result.total;
                    returnData.data = DyyBase.clearNull(dataset.result.list);
                    callback(returnData);
                });
            },
            'drawCallback': function () {
            },
            'columns': [
                {
                    data: 'interferenceType',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'pipeToSoilPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'acInterferenceVoltage',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'drainageAvg',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'openCircuitPotential',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'groundingResistance',
                    render: function (data) {
                        return '<span title="' + data + '">' + data + '</span>';
                    }
                },
                {
                    data: 'hasException',
                    render: function (data) {
                        if(data == false){
                            return '<span title="' + data + '">否</span>';
                        }else{
                            return '<span title="' + data + '">是</span>';
                        }
                    }
                },
                {
                    data: 'exceptionStated',
                    render: function (data) {
                        if(data == '未处理'){
                            return '<span class="lsk-no-color" title="' + data + '">' + data + '</span>';
                        }else{
                            return '<span title="' + data + '">' + data + '</span>';
                        }
                    }
                },
                {
                    data: 'recordTime',
                    render: function (data) {
                        return '<span title="' + Dyy.getDate(data) + '">' + Dyy.getDate(data) + '</span>';
                    }
                },
                {
                    data: 'id',
                    render: function (data) {
                        return '<i data-id="' + data + '" class="zy-details-icon" title="展开详情"></i>';
                    }
                },
                {
                    data: 'id',
                    render: function (data,type,row) {
                        var exId = row.exceptionId;
                        var hasEx = row.hasException;
                        var exState = row.exceptionStated;
                        if(exId) {
                            if (hasEx === true) {
                                if (exState === '未处理') {
                                    return '<i id="' + exId + '" class="xyf-except-icon" title="异常处理"></i>';
                                } else if (exState == '已处理') {
                                    return '<i id="' + exId + '" class="xyf-except-disabled-icon" title="异常处理"></i>';
                                } else {
                                    return '<span title="没有数据"></span>';
                                }
                            } else {
                                return '<span title="没有数据"></span>';
                            }
                        }else{
                            return '<span title="没有数据"></span>';
                        }
                    }
                }
            ]
        });
    }
    /*** 表格数据渲染end ***/

    /*** 腐蚀控制-运行记录跳转到异常处理页面 start ***/
    var $common_table = $('table.zy-datatable');
    //页面跳转函数
    function getHandle(v){
        var handleUrl = corrctrlApi.url_run_record_extremely() + '?exceptionId=' + v;
        window.location.href = handleUrl;
    }
    //阴保页面跳转
    $common_table.delegate('i.xyf-except-icon','click',function(event){
        // 当前对象
        var $this_i = $(this);
        var Id = $this_i.attr('id');
        getHandle(Id);
        event.stopPropagation()
    });
    /*** 腐蚀控制-运行记录跳转到异常处理页面 end ***/

    /*** 表格中数据的详情展示start ***/
    //展开详情
    $common_table.delegate('i.zy-details-icon','click',function(event){
        var $this = $(this);
        var $parent_tr = $this.parent('td').parent('tr');
        var Data,imgList;
        //判断执行相应的函数
        if(type == 'CPPOWER'){
            Data = DTPOWER.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTPOWER, $power_table, runTemplate['power'],imgList,'small');
        }else if(type == 'REFERENCE'){
            Data = DTLONG.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTLONG, $long_table, runTemplate['long'],imgList,'small');
        }else if(type == 'ANODESBED'){
            Data = DTBED.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTBED, $bed_table, runTemplate['bed'],imgList,'small');
        }else if(type == 'INSULATEDJOINT'){
            Data = DTINSU.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTINSU, $insu_table, runTemplate['insu'],imgList,'small');
        }else if(type == 'ANTISURGE'){
            Data = DTAVOID.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTAVOID, $avoid_table, runTemplate['avoid'],imgList,'small');
        }else if(type == 'CPJUMPER'){
            Data = DTLINE.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTLINE, $line_table, runTemplate['line'],imgList,'small');
        }else if(type == 'CPTESTSTATION'){
            Data = DTPILE.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            console.log(imgList);
            DyyBase.showDivDetails($(this),  DTPILE, $pile_table, runTemplate['pile'],imgList,'small');
        }else if(type == 'SAALANODE'){
            Data = DTSACRI.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTSACRI, $sacri_table, runTemplate['sacri'],imgList,'small');
        }else if(type == 'CURRENTDRAINAGE'){
            Data = DTELEC.row($parent_tr).data();
            imgList = DyyBase.getImagePath(Data.imagePaths);
            DyyBase.showDivDetails($(this), DTELEC, $elec_table, runTemplate['elec'],imgList,'small');
        }

        event.stopPropagation();
    });
    /*** 表格中数据的详情展示end ***/

    /*** 查询表格start ***/
    //阴保电源查询
    $('#JQ_power_search').click(function(){
        var param = filter.getPowerFilter();
        if(param.mode){
            if(DTPOWER){
                DTPOWER.draw();
                filter.getPowerExportFilter = filter.getPowerFilter();
            }
        }
    });
    //长效参比查询
    $('#JQ_long_search').click(function(){
        var param = filter.getLongFilter();
        if(param.mode){
            if(DTLONG){
                DTLONG.draw();
                filter.getLongExportFilter = filter.getLongFilter();
            }
        }
    });
    //阳极地床查询
    $('#JQ_bed_search').click(function(){
        var param = filter.getBedFilter();
        if(param.mode){
            if(DTBED){
                DTBED.draw();
                filter.getBedExportFilter = filter.getBedFilter();
            }
        }
    });
    //绝缘装置查询
    $('#JQ_insu_search').click(function(){
        var param = filter.getInsuFilter();
        if(param.mode){
            if(DTINSU){
                DTINSU.draw();
                filter.getInsuExportFilter = filter.getInsuFilter();
            }
        }
    });
    //防浪涌保护器置查询
    $('#JQ_avoid_search').click(function(){
        var param = filter.getAvoidFilter();
        if(param.mode){
            if(DTAVOID){
                DTAVOID.draw();
                filter.getAvoidExportFilter = filter.getAvoidFilter();
            }
        }
    });
    //跨接线查询
    $('#JQ_line_search').click(function(){
        var param = filter.getLineFilter();
        if(param.mode){
            if(DTLINE){
                DTLINE.draw();
                filter.getLineExportFilter = filter.getLineFilter();
            }
        }
    });
    //阴保测试桩查询
    $('#JQ_pile_search').click(function(){
        if(DTPILE){
            DTPILE.draw();
            filter.getPileExportFilter = filter.getPileFilter();
        }
    });
    //牺牲阳极查询
    $('#JQ_sacri_search').click(function(){
        var param = filter.getSacriFilter();
        if(param.mode){
            if(DTSACRI){
                DTSACRI.draw();
                filter.getSacriExportFilter = filter.getSacriFilter();
            }
        }
    });
    //排流装置查询
    $('#JQ_elec_search').click(function(){
        var param = filter.getElecFilter();
        if(param.mode){
            if(DTELEC){
                DTELEC.draw();
                filter.getElecExportFilter = filter.getElecFilter();
            }
        }
    });
    /*** 查询表格end ***/

    /*** 表格的导出功能start ***/
    //阴保电源导出
    $('#JQ_power_export').click(function(){
        var param = filter.getPowerExportFilter;
        var Num = $('#JQ_power_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '阴保电源' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeCPPOWER.json'
        });
    });
    //长效参比导出
    $('#JQ_long_export').click(function(){
        var param = filter.getLongExportFilter;
        var Num = $('#JQ_long_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '长效参比' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeREFERENCE.json'
        });
    });
    //阳极地床导出
    $('#JQ_bed_export').click(function(){
        var param = filter.getBedExportFilter;
        var Num = $('#JQ_bed_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '阳极地床' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeANODESBED.json'
        });
    });
    //绝缘装置导出
    $('#JQ_insu_export').click(function(){
        var param = filter.getInsuExportFilter;
        var Num = $('#JQ_insu_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '绝缘装置' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeINSEDJOINT.json'
        });
    });
    //防浪涌保护器导出
    $('#JQ_avoid_export').click(function(){
        var param = filter.getAvoidExportFilter;
        var Num = $('#JQ_avoid_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '防浪涌保护器' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeANTISURGE.json'
        });
    });
    //跨接线导出
    $('#JQ_line_export').click(function(){
        var param = filter.getLineExportFilter;
        var Num = $('#JQ_line_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '跨接线' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeCPJUMPER.json'
        });
    });
    //阴保测试桩导出
    $('#JQ_pile_export').click(function(){
        var param = filter.getPileExportFilter;
        var Num = $('#JQ_pile_testNum').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '阴保测试桩' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeCPTESTSTATION.json'
        });
    });
    //牺牲阳极导出
    $('#JQ_sacri_export').click(function(){
        var param = filter.getSacriExportFilter;
        var Num = $('#JQ_sacri_testNum').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '牺牲阳极' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeSAALANODE.json'
        });
    });
    //排流装置导出
    $('#JQ_elec_export').click(function(){
        var param = filter.getSacriExportFilter;
        var Num = $('#JQ_elec_number').text();
        if(param instanceof Function){
            param = param();
        }
        param.customNumber =Num;
        $(this).EXPT({
            type: 'name',
            name: '排流装置' + Num + '运行记录表',
            param: param,
            server: DyyBase.root_path + '/corrctrl/operRecords/exportRecodeDRAINAGE.json'
        });
    });
    /*** 表格的导出功能end ***/


    /*** 图表模块 start ***/
    //阴保电源统计图页面
    $('#JQ_power_count').click(function(){
        var $this = $(this);
        var status = $this.attr('data-empty');
        if(status == 'true'){
            $this.MSG({content: '没有运行记录,无法绘制统计图表!'});
            return false;
        }else{
            var param = filter.getPowerFilter();
            var id = param.deviceId;
            var url = corrctrlApi.url_record_power_html(id,type);
            window.location.href = url;
        }
    });

    //阴保测试桩统计图页面
    $('#JQ_pile_count').click(function(){
        var $this = $(this);
        var status = $this.attr('data-empty');
        if(status == 'true'){
            $this.MSG({content: '没有运行记录,无法绘制统计图表!'});
            return false;
        }else{
            var param = filter.getPileFilter();
            var id = param.deviceId;
            var url = corrctrlApi.url_record_pile_html(id,type);
            window.location.href = url;
        }
    });


    /*** 图表模块 end ***/

})(jQuery,window,document);